<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex align-stretch benben-position-layout flex sousuojieguo_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex align-center justify-between flex-sub sousuojieguo_fd0_0'>
          <view class='flex align-center' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
            <text class='fu-iconfont2  sousuojieguo_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex align-center flex-sub sousuojieguo_fd0_0_c1'>
            <text class='fu-iconfont2  sousuojieguo_fd0_0_c1_c0'>&#xe738;</text>
            <input class='flex-sub sousuojieguo_fd0_0_c1_c1' type="text" :placeholder="`请输入商品关键字`" confirm-type="done"
              :maxlength="-1" placeholder-style="color:rgba(191, 191, 191, 1);font-size:28rpx"
              @confirm="getShopMessageFunc()" v-model="keywords" />
          </view>
          <view class='flex flex-wrap align-center sousuojieguo_fd0_0_c2'>
            <image class='sousuojieguo_fd0_0_c2_c0' mode="aspectFit" :src='STATIC_URL+"598.png"'></image>
            <text class='sousuojieguo_fd0_0_c2_c1'>分类</text>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <view class="flex flex-direction align-stretch justify-center benben-position-layout flex sousuojieguo_flex_1"
        :style="{top:(87+StatusBarRpx)+'rpx', }">
        <view class='flex align-center self-center sousuojieguo_fd1_0'>
          <view class='flex align-center sousuojieguo_fd1_0_c0' @tap.stop="switchSwitch_typeFunc(1)">
            <text class='sousuojieguo_fd1_0_c0_c0' v-if="switch_type=='1'">综合</text><text
              class='sousuojieguo_fd1_0_c0_c0_1' v-if="switch_type!='1'">综合</text>
          </view>
          <view class='flex align-center sousuojieguo_fd1_0_c0' @tap.stop="switchSwitch_typeFunc(2)">
            <text class='sousuojieguo_fd1_0_c1_c0' v-if="switch_type!='2'">销量</text><text
              class='sousuojieguo_fd1_0_c1_c0_1' v-if="switch_type=='2'">销量</text>
            <image class='sousuojieguo_fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"237.png"'
              v-if="switch_type!='2'"></image>
            <image class='sousuojieguo_fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"599.png"'
              v-if="switch_type=='2' && sort_type=='asc'"></image>
            <image class='sousuojieguo_fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"600.png"'
              v-if="switch_type=='2' && sort_type=='desc'"></image>
          </view>
          <view class='flex align-center sousuojieguo_fd1_0_c0' @tap.stop="switchSwitch_typeFunc(3)">
            <text class='sousuojieguo_fd1_0_c1_c0' v-if="switch_type!='3'">价格</text><text
              class='sousuojieguo_fd1_0_c1_c0_1' v-if="switch_type=='3'">价格</text>
            <image class='sousuojieguo_fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"237.png"'
              v-if="switch_type!='3'"></image>
            <image class='sousuojieguo_fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"599.png"'
              v-if="switch_type=='3' && sort_type=='asc'"></image>
            <image class='sousuojieguo_fd1_0_c1_c1' mode="aspectFit" :src='STATIC_URL+"600.png"'
              v-if="switch_type=='3' && sort_type=='desc'"></image>
          </view>
          <view class='flex align-center sousuojieguo_fd1_0_c3'>
            <image class='sousuojieguo_fd1_0_c3_c0' mode="aspectFit" :src='STATIC_URL+"238.png"' @tap.stop="qhFunc()"
              v-if="cut=='1'"></image>
            <image class='sousuojieguo_fd1_0_c3_c0' mode="aspectFit" :src='STATIC_URL+"601.png"' @tap.stop="qhFunc()"
              v-if="cut=='2'"></image>
          </view>
        </view>

      </view>
      <view :style="{height: '100rpx'}"></view>
      <!---商品列表_商品flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout sousuojieguo_flex_2" v-if="cut=='2'">
        <template v-for='(item,key0) in dataList'>
          <view class='flex align-center sousuojieguo_fd2_0' :key='key0'>
            <image class='sousuojieguo_fd2_0_c0' mode="aspectFill" :src='item.thumb'></image>
            <view class='flex flex-direction flex-wrap align-stretch flex-sub sousuojieguo_fd2_0_c1'>
              <text class='sousuojieguo_fd2_0_c1_c0'>{{item.name}}</text>
              <view class='flex flex-direction flex-wrap align-stretch justify-between sousuojieguo_fd2_0_c1_c1'>
                <view class='flex flex-wrap align-center'>
                  <text class='sousuojieguo_fd2_0_c1_c1_c0_c0'>￥</text>
                  <text class=' sousuojieguo_fd2_0_c1_c1_c0_c1'>
                    <text class=' sousuojieguo_price1_fd2_0_c1_c1_c0_c1'>{{ item.shop_price | frontPrice }}</text>
                    <text class=' sousuojieguo_price2_fd2_0_c1_c1_c0_c1'>{{ item.shop_price | laterPrice }}</text>
                  </text>
                </view>
                <text class='sousuojieguo_fd2_0_c1_c1_c1'>{{item.market_price}}</text>
              </view>
            </view>
          </view>
        </template>
        <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
          :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
      </view>

      <!---商品列表_商品flex布局结束-->
      <!---商品列表_商品2flex布局开始-->
      <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout sousuojieguo_flex_3" v-if="cut=='1'">
        <view class='flex flex-wrap align-center justify-between sousuojieguo_fd3_0'>
          <template v-for='(item,key0) in dataList'>
            <view class='flex flex-direction flex-wrap align-stretch sousuojieguo_fd3_0_c0' :key='key0'>
              <view class='flex flex-wrap align-center'>
                <image class='sousuojieguo_fd3_0_c0_c0_c0' mode="aspectFill" :src='item.thumb'></image>
              </view>
              <view class='flex flex-wrap align-center sousuojieguo_fd3_0_c0_c1'>
                <text class='sousuojieguo_fd3_0_c0_c1_c0'>{{item.name}}</text>
              </view>
              <view class='flex flex-wrap align-center justify-between sousuojieguo_fd3_0_c0_c2'>
                <view class='flex flex-wrap align-center'>
                  <text class='sousuojieguo_fd3_0_c0_c2_c0_c0'>￥</text>
                  <text class=' sousuojieguo_fd3_0_c0_c2_c0_c1'>
                    <text class=' sousuojieguo_price1_fd3_0_c0_c2_c0_c1'>{{ 100 | frontPrice }}</text>
                    <text class=' sousuojieguo_price2_fd3_0_c0_c2_c0_c1'>{{ 100 | laterPrice }}</text>
                  </text>
                </view>
                <text class='sousuojieguo_fd3_0_c0_c2_c1'>{{item.market_price}}</text>
              </view>
            </view>
          </template>
          <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
            :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
        </view>
      </view>

      <!---商品列表_商品2flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center">
        <benben-to-top class='sousuojieguo_fd4_0' :scroll-top="pageScrollTopBuilt" :show-scroll-top='500'>
          <image class='sousuojieguo_fd4_0_c0' mode="aspectFit" :src='STATIC_URL+"602.png"'></image>

        </benben-to-top>
      </view>

      <!---flex布局flex布局结束-->
      <view class="flex flex-direction align-stretch benben-position-layout flex sousuojieguo_flex_5">
        <view class='flex flex-wrap align-center justify-between flex-sub sousuojieguo_fd5_0'>
          <view class='flex flex-direction flex-wrap align-center'>
            <image class='sousuojieguo_fd5_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"603.png"'></image>
            <text class='sousuojieguo_fd5_0_c0_c1'>首页</text>
          </view>
          <view class='flex flex-direction flex-wrap align-center'>
            <image class='sousuojieguo_fd5_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"604.png"'></image>
            <text class='sousuojieguo_fd5_0_c1_c1'>全部商品</text>
          </view>
          <view class='flex flex-direction flex-wrap align-center'>
            <image class='sousuojieguo_fd5_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"605.png"'></image>
            <text class='sousuojieguo_fd5_0_c0_c1'>商品分类</text>
          </view>
          <view class='flex flex-direction flex-wrap align-center' @tap.stop="goChatFunc()">
            <image class='sousuojieguo_fd5_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"606.png"'></image>
            <text class='sousuojieguo_fd5_0_c0_c1'>联系客服</text>
          </view>
        </view>

      </view>
      <view :style="{height: '100rpx'}"></view>


    </view>
  </view>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js'
  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "switch_type": "1",
        "sort_type": "desc",
        "is_new": "0",
        "cut": "1",
        "dataList": [],
        "keywords": "",
        "chatMessage": {
          "chat_url": ""
        },
        "pageScrollTopBuilt": 0,
        "shop_id": "85",
        "cid": ""
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },
      isLogin() {
        return this.$store.state.token == '' ? false : true;
      }
    },
    watch: {},
    onLoad(options) {
      let {
        shop_id,
        cid
      } = options
      if (shop_id !== undefined) this.shop_id = shop_id
      if (cid !== undefined) this.cid = cid
      this.getShopMessageFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
      this.getShopMessageFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {
      this.pageScrollTopBuilt = e.scrollTop
    },
    methods: {
      //获取店铺列表
      getShopMessageFunc() {
        this.minixPagingListsApi = global.apiUrls.post64184ac1cafc3;
        this.pageingListApiMethod = 'get';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          keyword: this.keywords,
          order: this.sort_type,
          sort: this.switch_type,
          goods_shop_category: this.cid,
          partner_id: this.shop_id,
          goods_type: this.is_new
        }
        this.listData = [];
        this.dataList = this.listData;
        this.pagingListToggle();

      },
      //商品切换
      qhFunc() {
        if (this.cut == '1') {
          this.cut = '2';
          return
        }
        if (this.cut == '2') {
          this.cut = '1';
          return
        }
      },
      //切换排序类型
      switchSwitch_typeFunc(type) {
        if (type == '2' || type == '3') {
          this.switch_type = type;
          this.is_new = '0';
          if (this.sort_type == 'desc') {
            this.sort_type = 'asc';
          } else {
            this.sort_type = 'desc';
          }
        }
        if (type == '4') {
          this.switch_type = '6';
          this.is_new = '4';
        }
        if (type == '1') {
          this.is_new = '0';
          this.switch_type = type;
        }
        this.minixPagingListsApi = global.apiUrls.post64184ac1cafc3;
        this.pageingListApiMethod = 'get';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          keyword: this.keywords,
          order: this.sort_type,
          sort: this.switch_type,
          goods_shop_category: this.cid,
          partner_id: this.shop_id,
          goods_type: this.is_new
        }
        this.listData = [];
        this.dataList = this.listData;
        this.pagingListToggle();

      },
      //跳转客服
      async goChatFunc() {
        if (this.isLogin === true) {
          //请求方法
          //数据验证

          let datachatMessage = await this.$api.get(global.apiUrls.post64897f6fd5486, {
            store_id: this.shop_id
          });

          if (datachatMessage.data.code != 1) {
            this.$message.info(datachatMessage.data.msg);
            return
          }
          let infochatMessage = datachatMessage.data;
          this.chatMessage = infochatMessage.data

          this.dynamicJump(this.chatMessage.chat_url);
        } else {
          this.$message.info('请先登录');
          this.toLoginDiy();
        }
      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(248, 248, 248, 1);
    background-size: 100% auto;
  }

  .sousuojieguo_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .sousuojieguo_fd0_0_c2_c1 {
    color: #333333;
    font-size: 28rpx;
    font-weight: 500;
    line-height: 40rpx;
    margin: 0rpx 0rpx 0rpx 6rpx;
  }

  .sousuojieguo_fd0_0_c2_c0 {
    width: 30rpx;
    height: 30rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd0_0_c2 {
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .sousuojieguo_fd0_0_c1_c1 {
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
  }

  .sousuojieguo_fd0_0_c1_c0 {
    font-size: 24rpx;
    color: rgba(153, 153, 153, 1);
    margin: 0rpx 14rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd0_0_c1 {
    background: #F9F9F9;
    height: 64rpx;
    border-radius: 34rpx 34rpx 34rpx 34rpx;
    padding: 0rpx 24rpx 0rpx 24rpx;
    margin: 0rpx 0rpx 0rpx 32rpx;
  }

  .sousuojieguo_fd0_0_c0_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
  }

  .sousuojieguo_fd0_0 {
    padding: 0rpx 24rpx 0rpx 24rpx;
    line-height: 88rpx;
  }

  .sousuojieguo_flex_1 {
    background: #fff;
    width: 750rpx;
    height: 100rpx;
    overflow: hidden;
    z-index: 10;
    top: 87rpx;
    background-size: 100% auto !important;
  }

  .sousuojieguo_fd1_0_c3_c0 {
    width: 30rpx;
    height: 28rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd1_0_c3 {
    margin: 0rpx 0rpx 0rpx auto;
  }

  .sousuojieguo_fd1_0_c1_c1 {
    width: 10rpx;
    height: 18rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd1_0_c1_c0_1 {
    padding: 0rpx 8rpx 0rpx 0rpx;
    color: var(--benbenFontColor5);
    font-size: 28rpx;
    font-weight: 400;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd1_0_c1_c0 {
    padding: 0rpx 8rpx 0rpx 0rpx;
    color: var(--benbenFontColor0);
    font-size: 28rpx;
    font-weight: 400;
    margin: 0rpx 16rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd1_0_c0_c0_1 {
    padding: 0rpx 8rpx 0rpx 0rpx;
    color: var(--benbenFontColor0);
    font-size: 28rpx;
    font-weight: 500;
  }

  .sousuojieguo_fd1_0_c0_c0 {
    padding: 0rpx 8rpx 0rpx 0rpx;
    color: var(--benbenFontColor5);
    font-size: 28rpx;
    font-weight: 500;
  }

  .sousuojieguo_fd1_0_c0 {
    margin: 0rpx 70rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd1_0 {
    padding: 0rpx 32rpx 0rpx 47rpx;
    font-size: 28rpx;
    font-weight: 400;
    line-height: 40rpx;
  }

  .sousuojieguo_flex_2 {
    padding: 24rpx 24rpx 0rpx 24rpx;
  }

  .sousuojieguo_fd2_0_c1_c1_c1 {
    color: var(--benbenFontColor2);
    font-size: 24rpx;
    font-weight: 400;
    line-height: 33rpx;
    text-decoration: line-through;
  }

  .sousuojieguo_price2_fd2_0_c1_c1_c0_c1 {
    font-size: 22rpx;
  }

  .sousuojieguo_price1_fd2_0_c1_c1_c0_c1 {
    font-size: 56rpx;
  }

  .sousuojieguo_fd2_0_c1_c1_c0_c1 {
    color: rgba(204, 0, 0, 1);
    font-weight: 700;
    font-size: 24rpx;
  }

  .sousuojieguo_fd2_0_c1_c1_c0_c0 {
    font-size: 20rpx;
    font-weight: 700;
    color: rgba(204, 0, 0, 1);
  }

  .sousuojieguo_fd2_0_c1_c1 {
    margin: 10rpx 0rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd2_0_c1_c0 {
    line-height: 40rpx;
    font-size: 28rpx;
    font-weight: 600;
    color: var(--benbenFontColor0);
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .sousuojieguo_fd2_0_c1 {
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .sousuojieguo_fd2_0_c0 {
    width: 220rpx;
    height: 220rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .sousuojieguo_fd2_0 {
    background: #fff;
    padding: 24rpx 24rpx 24rpx 24rpx;
    background-size: 100% auto !important;
    margin: 0rpx 0rpx 16rpx 0rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .sousuojieguo_flex_3 {
    padding: 24rpx 0rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd3_0_c0_c2_c1 {
    color: var(--benbenFontColor2);
    font-size: 24rpx;
    font-weight: 400;
    line-height: 33rpx;
    text-decoration: line-through;
  }

  .sousuojieguo_price2_fd3_0_c0_c2_c0_c1 {
    font-size: 28rpx;
  }

  .sousuojieguo_price1_fd3_0_c0_c2_c0_c1 {
    font-size: 32rpx;
  }

  .sousuojieguo_fd3_0_c0_c2_c0_c1 {
    color: rgba(204, 0, 0, 1);
    font-weight: 600;
    font-size: 40rpx;
  }

  .sousuojieguo_fd3_0_c0_c2_c0_c0 {
    font-size: 20rpx;
    font-weight: 700;
    color: rgba(204, 0, 0, 1);
  }

  .sousuojieguo_fd3_0_c0_c2 {
    padding: 20rpx 20rpx 8rpx 20rpx;
  }

  .sousuojieguo_fd3_0_c0_c1_c0 {
    font-size: 28rpx;
    font-weight: 500;
    color: var(--benbenFontColor0);
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    line-height: 40rpx;
    height: 80rpx;
  }

  .sousuojieguo_fd3_0_c0_c1 {
    padding: 0rpx 20rpx 0rpx 20rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd3_0_c0_c0_c0 {
    width: 346rpx;
    height: 346rpx;
    border-radius: 16rpx 16rpx 0rpx 0rpx;
  }

  .sousuojieguo_fd3_0_c0 {
    background: #fff;
    margin: 0rpx 0rpx 10rpx 0rpx;
    width: 350rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    padding: 0rpx 0rpx 30rpx 0rpx;
  }

  .sousuojieguo_fd3_0 {
    padding: 0rpx 14rpx 0rpx 14rpx;
  }

  .sousuojieguo_fd4_0_c0 {
    background: var(--benbenbgColor1);
    width: 80rpx;
    height: 80rpx;
    border-radius: 40rpx;
    background-size: 100% auto;
  }

  .sousuojieguo_fd4_0 {
    position: fixed;
    z-index: 50;
    bottom: calc(300rpx + var(--window-bottom));
    right: 30rpx;
  }

  .sousuojieguo_flex_5 {
    background: #fff;
    width: 750rpx;
    height: 100rpx;
    overflow: hidden;
    z-index: 10;
    bottom: calc(0rpx + var(--window-bottom));
    background-size: 100% auto !important;
  }

  .sousuojieguo_fd5_0_c1_c1 {
    color: var(--benbenFontColor5);
    font-size: 22rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .sousuojieguo_fd5_0_c0_c1 {
    color: var(--benbenFontColor0);
    font-size: 22rpx;
    font-weight: 400;
    line-height: 30rpx;
  }

  .sousuojieguo_fd5_0_c0_c0 {
    width: 48rpx;
    height: 48rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
    margin: 0rpx 0rpx 2rpx 0rpx;
  }

  .sousuojieguo_fd5_0 {
    padding: 0rpx 70rpx 0rpx 70rpx;
  }
</style>